package com.zlp.invoke;

/**
 * 测试字段不参与多态
 */
public class FeildTest {

    static class Father{
        int monkey = 1;
        Father(){
            monkey = 2;
            showMonkey();
        }

        public void showMonkey() {
            System.out.println("Father: hava monkey"+monkey);
        }
    }

    static class Son extends Father{
        int monkey = 3;
        Son(){
            monkey = 4;
            showMonkey();
        }
        @Override
        public void showMonkey() {
            System.out.println("Son: hava monkey"+monkey);
        }
    }

    public static void main(String[] args) {
        Father son = new Son();
        System.out.println(son.monkey);
    }
}
